package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.SoftwareLinkMapper;
import com.ruoyi.web.domain.SoftwareLink;
import com.ruoyi.web.service.ISoftwareLinkService;

/**
 * 下载链接Service业务层处理
 *
 * @author song
 * @date 2024-08-26
 */
@Service
public class SoftwareLinkServiceImpl implements ISoftwareLinkService
{
    @Autowired
    private SoftwareLinkMapper softwareLinkMapper;

    /**
     * 查询下载链接
     *
     * @param linkId 下载链接主键
     * @return 下载链接
     */
    @Override
    public SoftwareLink selectSoftwareLinkByLinkId(Long linkId)
    {
        return softwareLinkMapper.selectSoftwareLinkByLinkId(linkId);
    }

    /**
     * 查询下载链接列表
     *
     * @param softwareLink 下载链接
     * @return 下载链接
     */
    @Override
    public List<SoftwareLink> selectSoftwareLinkList(SoftwareLink softwareLink)
    {
        return softwareLinkMapper.selectSoftwareLinkList(softwareLink);
    }

    /**
     * 新增下载链接
     *
     * @param softwareLink 下载链接
     * @return 结果
     */
    @Override
    public int insertSoftwareLink(SoftwareLink softwareLink)
    {
        softwareLink.setCreateTime(DateUtils.getNowDate());
        softwareLink.setUpdateTime(DateUtils.getNowDate());
        return softwareLinkMapper.insertSoftwareLink(softwareLink);
    }

    /**
     * 修改下载链接
     *
     * @param softwareLink 下载链接
     * @return 结果
     */
    @Override
    public int updateSoftwareLink(SoftwareLink softwareLink)
    {
        softwareLink.setUpdateTime(DateUtils.getNowDate());
        return softwareLinkMapper.updateSoftwareLink(softwareLink);
    }

    /**
     * 批量删除下载链接
     *
     * @param linkIds 需要删除的下载链接主键
     * @return 结果
     */
    @Override
    public int deleteSoftwareLinkByLinkIds(Long[] linkIds)
    {
        return softwareLinkMapper.deleteSoftwareLinkByLinkIds(linkIds);
    }

    /**
     * 删除下载链接信息
     *
     * @param linkId 下载链接主键
     * @return 结果
     */
    @Override
    public int deleteSoftwareLinkByLinkId(Long linkId)
    {
        return softwareLinkMapper.deleteSoftwareLinkByLinkId(linkId);
    }
}
